home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************************/
- /* */
- /* Module Name: ToolFunctions */
- /* */
- /* File Name: ToolFunctions.c */
- /* */
- /* © Apple Computer, Inc. 1991-1995 */
- /* All Rights Reserved */
- /* */
- /* Revision History: */
- /* */
- /* Date Who Modification */
- /* */
- /* 1991-08-02 Chris Halim Original version */
- /* 1995-06-26 Jaakko Railo Version 2.0 */
- /* */
- /************************************************************************************************/
-
- /****************************************** DESCRIPTION ******************************************
-
- This module calls TELToolFunctions on the passed termHand.
-
- *************************************************************************************************/
-
- /******************************************** HEADERS *******************************************/
-
- #include "Resources.h"
-
- #ifndef __TELEPHONETOOLS__
- #include "TelephoneTools.h"
- #endif
-
- #include "TestModule.h"
-
- /****************************************** DEFINITIONS *****************************************/
-
- #define rToolFunctionDLOG 10000
- #define kUnsupportedToolsRadio 4
- #define kSupportedToolsRadio 5
- #define kAllToolsRadio 6
-
- #if defined(powerc) || defined (__powerc)
- #pragma options align=mac68k
- #endif
- struct MessagesStructure {
- char *name;
- short msg;
- };
- #if defined(powerc) || defined(__powerc)
- #pragma options align=reset
- #endif
-
- typedef struct MessagesStructure MessagesStructure;
-
- #if defined(powerc) || defined (__powerc)
- #pragma options align=mac68k
- #endif
- struct RadioStructure {
- short min;
- short max;
- short current;
- };
- #if defined(powerc) || defined(__powerc)
- #pragma options align=reset
- #endif
-
- typedef struct RadioStructure RadioStructure;
-
- /****************************************** PROTOTYPES ******************************************/
-
- short DisplayToolFunctionDialog (CHRSPtr paramPtr, short *option);
- void DoTest (CHRSPtr paramPtr);
-
- /************************************************************************************************/
- /************************************************************************************************/
-
-
- pascal short TestModule (CHRSPtr paramPtr)
- {
- short returnValue = noErr;
-
- if (paramPtr->version <= kTestModuleVersion) {
-
- DoTest (paramPtr);
-
- }
- else
- returnValue = kWrongVersion;
-
- return (returnValue);
- }
-
-
-
- void DoTest (CHRSPtr paramPtr)
- {
- TELHandle termHand = GetCurrentTELHandle (paramPtr);
- OSErr errCode;
- Boolean supportsIt;
- short index, option;
- MessagesStructure array[] = {
- { "telGetInfoMsg", telGetInfoMsg },
- { "telOpenTermMsg", telOpenTermMsg },
- { "telResetTermMsg", telResetTermMsg },
- { "telCloseTermMsg", telCloseTermMsg },
-
- { "telTermMsgHandMsg", telTermMsgHandMsg },
- { "telClrTermMsgHandMsg", telClrTermMsgHandMsg },
- { "telTermEventsSuppMsg", telTermEventsSuppMsg },
-
- // { "telGetProcIDMsg", telGetProcIDMsg },
- { "telNewMsg", telNewMsg },
- { "telDefaultMsg", telDefaultMsg },
- { "telValidateMsg", telValidateMsg },
- // { "telGetConfigMsg", telGetConfigMsg },
- // { "telSetConfigMsg", telSetConfigMsg },
- // { "telChooseMsg", telChooseMsg },
-
- { "telSpreflightMsg", telSpreflightMsg },
- { "telSsetupMsg", telSsetupMsg },
- { "telSfilterMsg", telSfilterMsg },
- { "telSitemMsg", telSitemMsg },
- { "telScleanupMsg", telScleanupMsg },
- // { "telSpostFlightMsg", telSpostFlightMsg },
- { "telDisposeMsg", telDisposeMsg },
-
-
- { "telCountDNsMsg", telCountDNsMsg },
- { "telDNLookupByIndexMsg", telDNLookupByIndexMsg },
- { "telDNLookupByNameMsg", telDNLookupByNameMsg },
- { "telGetDNInfoMsg", telGetDNInfoMsg },
- { "telDNSelectMsg", telDNSelectMsg },
- { "telDNDisposeMsg", telDNDisposeMsg },
- { "telGetDNFlagsMsg", telGetDNFlagsMsg },
-
- { "telDNMsgHandMsg", telDNMsgHandMsg },
- { "telClrDNMsgHandMsg", telClrDNMsgHandMsg },
- { "telDNEventsSuppMsg", telDNEventsSuppMsg },
-
-
- { "telCountCAsMsg", telCountCAsMsg },
- { "telCALookupMsg", telCALookupMsg },
- { "telGetCAInfoMsg", telGetCAInfoMsg },
- { "telCADisposeMsg", telCADisposeMsg },
- { "telGetCAStateMsg", telGetCAStateMsg },
- { "telGetCAFlagsMsg", telGetCAFlagsMsg },
-
- { "telCAMsgHandMsg", telCAMsgHandMsg },
- { "telClrCAMsgHandMsg", telClrCAMsgHandMsg },
- { "telCAEventsSuppMsg", telCAEventsSuppMsg },
-
- { "telSetupCallMsg", telSetupCallMsg },
- { "telConnectMsg", telConnectMsg },
- { "telDialDigitsMsg", telDialDigitsMsg },
-
- { "telAcceptCallMsg", telAcceptCallMsg },
- { "telRejectCallMsg", telRejectCallMsg },
- { "telDeflectCallMsg", telDeflectCallMsg },
- { "telAnswerCallMsg", telAnswerCallMsg },
-
- { "telDropMsg", telDropMsg },
-
- { "telHoldMsg", telHoldMsg },
- { "telRetrieveMsg", telRetrieveMsg },
-
- { "telConfPrepMsg", telConfPrepMsg },
- { "telConfEstMsg", telConfEstMsg },
- { "telConfSplitMsg", telConfSplitMsg },
-
- { "telTransfPrepMsg", telTransfPrepMsg },
- { "telTransfEstMsg", telTransfEstMsg },
- { "telTransfBlindMsg", telTransfBlindMsg },
-
- { "telForwardSetMsg", telForwardSetMsg },
- { "telForwardClearMsg", telForwardClearMsg },
-
- { "telCallbackSetMsg", telCallbackSetMsg },
- { "telCallbackNowMsg", telCallbackNowMsg },
- { "telCallbackClearMsg", telCallbackClearMsg },
-
- { "telDNDSetMsg", telDNDSetMsg },
- { "telDNDClearMsg", telDNDClearMsg },
-
- { "telCallPickupMsg", telCallPickupMsg },
-
- { "telParkCallMsg", telParkCallMsg },
- { "telRetrieveParkedCallMsg", telRetrieveParkedCallMsg },
-
- { "telVoiceMailAccessMsg", telVoiceMailAccessMsg },
-
- { "telPagingMsg", telPagingMsg },
-
- { "telIntercomMsg", telIntercomMsg },
-
- { "telOtherFunctionMsg", telOtherFunctionMsg },
- { "telOtherFeatListMsg", telOtherFeatListMsg },
- { "telOtherFeatImplMsg", telOtherFeatImplMsg },
- { "telToolFunctionsMsg", telToolFunctionsMsg },
-
- { "telGetHookswMsg", telGetHookswMsg },
- { "telSetHookswMsg", telSetHookswMsg },
- { "telGetVolumeMsg", telGetVolumeMsg },
- { "telSetVolumeMsg", telSetVolumeMsg },
- { "telAlertMsg", telAlertMsg },
- { "telGetDisplayMsg", telGetDisplayMsg },
- { "telSetDisplayMsg", telSetDisplayMsg },
-
- { "telActivateMsg", telActivateMsg },
- { "telDeactivateMsg", telDeactivateMsg },
- { "telResumeMsg", telResumeMsg },
- { "telSuspendMsg", telSuspendMsg },
- { "telMenuMsg", telMenuMsg },
- { "telEventMsg", telEventMsg },
- // { "telGetToolNameMsg", telGetToolNameMsg },
- // { "telGetVersionMsg", telGetVersionMsg },
- // { "telGetTELVersionMsg", telGetTELVersionMsg },
- { "telIdleMsg", telIdleMsg },
-
- { "telL2EnglishMsg", telL2EnglishMsg },
- { "telL2IntlMsg", telL2IntlMsg }
- };
-
- if (DisplayToolFunctionDialog (paramPtr, &option) == ok)
- {
- switch (option) {
- case kAllToolsRadio :
- for (index = 0; index < (sizeof(array) / sizeof(MessagesStructure)); ++index)
- {
- if ((errCode = TELToolFunctions (termHand, array[index].msg, &supportsIt)) == noErr)
- Print (paramPtr, "%s %s", (supportsIt?"√":" "), array[index].name);
- else {
- Print (paramPtr, "### TELToolFunctions failed : %d", errCode);
- break;
- }
- }
- break;
-
- case kSupportedToolsRadio :
- for (index = 0; index < (sizeof(array) / sizeof(MessagesStructure)); ++index)
- {
- if ((errCode = TELToolFunctions (termHand, array[index].msg, &supportsIt)) == noErr)
- {
- if (supportsIt)
- Print (paramPtr, "√ %s", array[index].name);
- }
- else {
- Print (paramPtr, "### TELToolFunctions failed : %d", errCode);
- break;
- }
- }
- break;
-
- case kUnsupportedToolsRadio :
- for (index = 0; index < (sizeof(array) / sizeof(MessagesStructure)); ++index)
- {
- if ((errCode = TELToolFunctions (termHand, array[index].msg, &supportsIt)) == noErr)
- {
- if (!supportsIt)
- Print (paramPtr, " %s", array[index].name);
- }
- else {
- Print (paramPtr, "### TELToolFunctions failed : %d", errCode);
- break;
- }
- }
- break;
- }
- }
- }
-
-
- short DisplayToolFunctionDialog (CHRSPtr paramPtr, short *option)
- {
- DialogPtr theDialog;
- short itemHit, index = 0;
- short itemKind;
- Handle itemHand;
- Rect itemRect;
- RadioStructure radio = {kUnsupportedToolsRadio,kAllToolsRadio,kUnsupportedToolsRadio};
-
- theDialog = GetNewDialog (rToolFunctionDLOG, nil, (WindowPtr)(-1L));
- if (theDialog == nil) {
- Print (paramPtr, "### Can't find the DLOG resource : %d", ResError());
- return (-1);
- }
-
- for (index = radio.min; index <= radio.max; ++index) {
- GetDItem (theDialog, index, &itemKind, &itemHand, &itemRect);
- SetCtlValue ((ControlHandle) itemHand, (index == radio.current)?1:0);
- }
-
- ShowWindow (theDialog);
-
- do {
- ModalDialog (nil, &itemHit);
-
- switch (itemHit) {
- case ok :
- *option = radio.current;
- break;
-
- case kUnsupportedToolsRadio :
- case kSupportedToolsRadio :
- case kAllToolsRadio :
- GetDItem (theDialog, radio.current, &itemKind, &itemHand, &itemRect);
- SetCtlValue ((ControlHandle) itemHand, 0);
-
- radio.current = itemHit;
- GetDItem (theDialog, itemHit, &itemKind, &itemHand, &itemRect);
- SetCtlValue ((ControlHandle) itemHand, 1);
- break;
- }
- } while ((itemHit != ok) && (itemHit != cancel));
-
- DisposDialog (theDialog);
-
- return (itemHit);
- }
-
-
-